﻿namespace Creek.UI.EFML.Base.EFML.Elements
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Xml;

    public class ValidatorElement : ElementBase
    {
        #region Fields

        public string Name;

        public string Pattern;

        #endregion

        #region Public Methods and Operators

        public override void Process(List<ElementBase> Tree, EFMLDocument m)
        {
            Tree.AddRange(
                (from XmlNode child in m.Head.ChildNodes
                 where child.Name == "validator"
                 select
                     new ValidatorElement
                         { Name = child.GetAttributeByName("name"), Pattern = child.GetAttributeByName("pattern") }));
        }

        #endregion
    }
}